package com.ruoyi.redtea.dualprevent.domain.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 人员与部门多对表的中间表，用于嵌套记录，一个部门下多个部门或人一个人挂在多个部门下
 * @TableName train_dept_user
 */
@TableName(value ="train_dept_user")
@Data
public class TrainDeptUser implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Integer unionId;

    /**
     * 部门id
     */
    private Integer deptId;

    /**
     * 子部门或部门下人的id
     */
    private Integer sonId;

    /**
     * 1:部门id 2:人员id
     */
    private Integer sonType;

    /**
     * 
     */
    private Date updateTime;

    /**
     * 
     */
    private Date createTime;

    /**
     * 
     */
    @TableLogic
    private Integer isdel;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TrainDeptUser other = (TrainDeptUser) that;
        return (this.getUnionId() == null ? other.getUnionId() == null : this.getUnionId().equals(other.getUnionId()))
            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()))
            && (this.getSonId() == null ? other.getSonId() == null : this.getSonId().equals(other.getSonId()))
            && (this.getSonType() == null ? other.getSonType() == null : this.getSonType().equals(other.getSonType()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getIsdel() == null ? other.getIsdel() == null : this.getIsdel().equals(other.getIsdel()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUnionId() == null) ? 0 : getUnionId().hashCode());
        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
        result = prime * result + ((getSonId() == null) ? 0 : getSonId().hashCode());
        result = prime * result + ((getSonType() == null) ? 0 : getSonType().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getIsdel() == null) ? 0 : getIsdel().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", unionId=").append(unionId);
        sb.append(", deptId=").append(deptId);
        sb.append(", sonId=").append(sonId);
        sb.append(", sonType=").append(sonType);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", createTime=").append(createTime);
        sb.append(", isdel=").append(isdel);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}